module middleware.Corss;

import archttp : HttpRequest, HttpResponse;

/** 
 * 跨域中间件
 */
void corss(HttpRequest req, HttpResponse res, void delegate() next)
{
    req.header("Access-Control-Allow-Origin", "*")
        .header("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS")
        .header("Access-Control-Allow-Headers", "*");
    next();
}
